package br.edu.com1263.dao;

import java.util.Collection;

import javax.persistence.Query;

import br.edu.com1263.model.Disciplina;

public class DisciplinaDAOImpl extends AbstractDAO implements DisciplinaDAO{
	
	public DisciplinaDAOImpl(){

}

	

	@Override
	public Collection<Disciplina> consultarTodos() {
		Query query = manager.createQuery("SELECT d FROM Disciplina d");
		return query.getResultList();
	}

	@Override
	public void salvar(Disciplina disciplina) {
		manager.persist(disciplina);
		
	}
	
	
	public void alterar(Disciplina disciplina) {
		manager.merge(disciplina);
	}
    
    public void remover(Disciplina disciplina) {
		manager.remove(disciplina);
	}

	@Override
	public Disciplina consultar(Long id) {
		return manager.find(Disciplina.class, id);
	}

}
